package unit4_1015.test3;

import java.util.Scanner;

public class Test {

	@SuppressWarnings("resource")
	public static void main(String[] args) {
		/*
		 * 让用户输入选择---Scanner.
		 * 需要调用主人的方法---Master
		 * 先提示选择宠物;
		 * 然后给宠物各属性赋值.
		 * 诊断治疗,喂食物.
		 * 
		 */
		Scanner scanner = new Scanner(System.in);
		Master master = new Master();
		
		System.out.println("欢迎访问电子宠物系统");
		System.out.println("请选择宠物种类:\n1.狗\t2.猫");
		int petType = scanner.nextInt();
		if(petType==1) {
			System.out.println("您选择了宠物狗");
			Dog dog = new Dog();
			System.out.print("请输入宠物狗的昵称:");
			dog.setName(scanner.next());
			System.out.print("请输入宠物狗的健康值(1-100):");
			dog.setHealth(scanner.nextInt());
			System.out.print("请输入宠物狗的性别:1.公\t2.母");
			dog.setSex(scanner.nextInt()==1?"公":"母");
			System.out.print("请输入宠物狗与主人的亲密度(1-10):");
			dog.setLove(scanner.nextInt());
			master.cure(dog);
			master.feed(dog);
		}else {
			System.out.println("您选择了宠物猫");
			Cat cat = new Cat();
			System.out.print("请输入宠物狗猫的昵称:");
			cat.setName(scanner.next());
			System.out.print("请输入宠物猫的健康值(1-100):");
			cat.setHealth(scanner.nextInt());
			System.out.print("请输入宠物猫的性别:1.公\t2.母");
			cat.setSex(scanner.nextInt()==1?"公":"母");
			System.out.print("请输入宠物猫懒度(1-10):");
			cat.setLazy(scanner.nextInt());
			master.cure(cat);
			master.feed(cat);
		}
		
		
		
	}

}
